/*
 * @Author: szx
 * @Date: 2022-03-16 13:30:22
 * @LastEditTime: 2022-03-16 13:34:03
 * @Description:
 * @FilePath: \leetcode\400-499\455\455_2.js
 */
/**
 * @param {number[]} g
 * @param {number[]} s
 * @return {number}
 */
var findContentChildren = function (g, s) {
    g.sort((a, b) => b - a);
    s.sort((a, b) => b - a);
    let j = 0;
    let res = 0;
    for (let i of g) {
        if (i <= s[j]) {
            j++;
            res++;
        }
    }
    return res;
};
